package com.logistics.service.Impl;

import com.logistics.dao.BaseDao;
import com.logistics.dao.StaffDao;
import com.logistics.entity.Staff;
import com.logistics.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Ranger on 2015/8/14.
 */
@Service
public class StaffServiceImpl extends BaseServiceImpl<Staff> implements StaffService {
    @Autowired
    private StaffDao staffDao;

    @Override
    public BaseDao getBaseDao() {
        return staffDao;
    }

    @Override
    public Integer add(Staff staff) {
        // 人员的身份证号和姓名不能为空
        if (staff.getIdCardNumber().isEmpty() || staff.getRealName().isEmpty()) {
            return null;
        }
        return super.add(staff);
    }

    @Override
    public void update(Staff staff) {
        // 人员的身份证号和姓名不能为空
        if (staff.getIdCardNumber().isEmpty() || staff.getRealName().isEmpty()) {
            return;
        }
        super.update(staff);
    }
}
